package org.example.sys_weapons;


import org.example.Utils.ConsoleColorOutput;
import org.example.Utils.ConsoleStyle;
import org.example.sys_weapons.pojo.GoldenDescendantDto;

import java.util.ArrayList;
import java.util.Random;


public class NeiKos {

    // 当前 火种数量
    public static int fire = 0;

    // 黑厄 锁定 概率
    private static double blackEtherLockProbability = 10;
    // 黑厄 保底 概率
    private static double blackEtherLockProbabilityBase = 0;


    public static void nextFire() {
        ArrayList<GoldenDescendantDto> goldenDescendant = new ArrayList<>(World.GoldenDescendant);
        if (goldenDescendant.isEmpty()) {
            return;
        }
        goldenDescendant.forEach(e -> {
            double blackEtherLockProbabilityRandom = new Random().nextDouble(blackEtherLockProbability) + blackEtherLockProbabilityBase;
            blackEtherLockProbability += 5;
            blackEtherLockProbabilityBase += 5;

            if (e.getRandom() < blackEtherLockProbabilityRandom) {
                fire++;
                World.GoldenDescendant.remove(e);
                ConsoleColorOutput.outputCenter(ConsoleStyle.RED, ConsoleStyle.GREEN, "[逐火"+ World.round +"年] 实体:「", e.getName(), "」已被卡厄斯兰纳锁定");
                ConsoleColorOutput.outputLine(ConsoleStyle.RED, "[逐火"+ World.round +"年] 卡厄斯兰纳 将" + e.getKindling() + "之火种收于己身。当前持有" + fire + "枚火");
            }
        });
    }

}
